﻿namespace FFF.Test.Application.AppServices
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Threading.Tasks;
    using Abp.Application.Services;
    using Abp.Application.Services.Dto;
    using Abp.Domain.Entities;
    using Microsoft.AspNetCore.Mvc;
    using FFF.Test.Application.AppServices.PublicService.Grid;
    using FFF.Test.Application.Framework.Dto;
    using FFF.Test.Application.Repositories;

    /// <summary>
    /// appervice的增删改查
    /// </summary>
    /// <typeparam name="TEntity">实体对象</typeparam>
    /// <typeparam name="TPrimaryKey">主键</typeparam>
    /// <typeparam name="TCreateInput">新增输入</typeparam>
    /// <typeparam name="TUpdateInput">删除输入</typeparam>
    /// <typeparam name="TEntityDto">实体输入</typeparam>
    /// <typeparam name="TView">view的类型</typeparam>
    /// <typeparam name="TViewDto">viewDto的展示</typeparam>
    public interface IYdmAbpCurdAppService<TEntity, TPrimaryKey, TCreateInput, TUpdateInput, TEntityDto, TView, TViewDto>
        where TEntity : class, IEntity<TPrimaryKey>
        where TView : class, IEntity<TPrimaryKey>
        where TViewDto : class
        where TCreateInput : class, IEntityDto<TPrimaryKey>
        where TUpdateInput : class, IEntityDto<TPrimaryKey>
        where TEntityDto : class, IEntityDto<TPrimaryKey>
    {
        /// <summary>
        /// 获取表格汇总数据
        /// </summary>
        /// <param name="inDto">输入Dto</param>
        /// <returns>输出dto</returns>
        Task<GetGridSummaryOutDto> GetGridSummary(GetGridSummaryInDto inDto);

        /// <summary>   
        ///  获取视图分页信息obj 通过select("new(CompanyName as Name, Phone)") 这种方式获取
        /// </summary>
        /// <param name="pagedInputDto">分页输入的Dto</param>
        /// <returns>分页对象</returns>
        Task<MyPagedResult<object>> GetViewPageSelect(PagedInputDto pagedInputDto);

        /// <summary>
        /// 导入数据
        /// </summary>
        /// <param name="inDto">导入对象</param>
        /// <returns>提示信息</returns>
        Task<ImportOutDto> ImportExcel(ImportInDto inDto);

        /// <summary>
        /// 导出表格数据
        /// </summary>
        /// <param name="inDto">获取导出表格数据输入dto</param>
        /// <returns>dto对象</returns>
        Task<FileContentResult> GetGridExcel(GetGridListInDto inDto);

        /// <summary>
        /// 获取表格数据
        /// </summary>
        /// <param name="inDto">获取表格数据输入dto</param>
        /// <returns>dto对象</returns>
        Task<GridResult> GetGridDto(GetGridListInDto inDto);

        ///// <summary>
        ///// 获取单个实体实体数据
        ///// </summary>
        ///// <param name="id">实体的ID</param>
        ///// <returns>视图数据</returns>
        //Task<TEntityDto> GetDto(TPrimaryKey id);

        /// <summary>
        /// 获取单个实体View的实体数据
        /// </summary>
        /// <param name="idDto">实体的IdDto</param>
        /// <returns>视图数据</returns>
        Task<TViewDto> GetViewDto(PrimaryDto idDto);

        /// <summary>   
        ///  视图分页
        /// </summary>
        /// <param name="pagedInputDto">分页输入对象</param>
        /// <returns>分页对象</returns>
        Task<MyPagedResult<TViewDto>> GetViewPage(PagedInputDto pagedInputDto);

        /// <summary>
        /// 实体创建异步
        /// </summary>
        /// <param name="input">输入对象</param>
        /// <returns>返回输出对象</returns>
        Task<TEntityDto> CreateByDto(TCreateInput input);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="input">更新输入对象</param>
        /// <returns>主键值</returns>
        Task<TEntityDto> UpdateByDto(TUpdateInput input);

        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="input">更新的实体的对象</param>
        /// <returns>更新后的对象</returns>
        Task BatchUpdateByDto(BatchUpdateInDto input);

        /// <summary>
        /// 删除  [学生表] 传递包含id的dto
        /// </summary>
        /// <param name="idDto">实体的IdDto</param>
        /// <returns> task 空值</returns>
        Task BatchDelete(PrimaryDto idDto);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="idDto">实体的IdDto</param>
        /// <returns>空</returns>
        Task DeleteByDto(PrimaryDto idDto);
    }
}
